package com.shujia.wyh.day26;

/*
        解决同步安全问题的方案2：使用Lock锁
        注意：多个线程对象拥有的锁对象要一致
 */
public class SellTicketDemo3 {
    public static void main(String[] args) {
        //创建Runnable类对象
        TicketWindow3 ticketWindow1 = new TicketWindow3();

        //借助Thread类创建线程对象
        Thread window1 = new Thread(ticketWindow1, "窗口1");
        Thread window2 = new Thread(ticketWindow1, "窗口2");
        Thread window3 = new Thread(ticketWindow1, "窗口3");

        //启动线程
        window1.start();
        window2.start();
        window3.start();
    }
}
